package com.jmemoir.base.async.impl;

import com.jmemoir.base.async.AsyncTestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;

import java.util.concurrent.Future;

/**
 * 测试异步接口-实现类
 *
 * @author Tellsea
 * @date 2023/8/2
 */
@Slf4j
@Service
public class AsyncServiceImpl implements AsyncTestService {

    @Async
    @Override
    public void handleBusiness() {
        log.info("测试业务执行");
    }

    @Override
    public Future<String> hasReturn() {
        return new AsyncResult<>("我是返回的消息");
    }
}
